package com.hamishmedlin.d64pw;

public class QUtils {

	public static int intDivide(int dividend,int divisor){
		double top = (double)dividend;
		double bottom = (double)divisor;		
		return (int)(top/bottom);		
	}

	public static int intMod(int dividend,int divisor){
		double top = (double)dividend;
		double bottom = (double)divisor;		
		return (int)(top%bottom);		
	}
	
	public static int makeBE16(int byte1,int byte2){		
		return ((byte1 << 8) | byte2);
	}
	
	public static int[] unmakeBE16(int innum){		
		int b1 = (innum & 0x00ff);
		int b2 =  ((innum & 0xff00) >> 8);
		
		return new int[]{b1,b2};
	}
	
	public static int byteSwap(int innum){
		int low = (innum & 0x00ff) << 8;
		int high = (innum & 0xff00) >> 8;		
		return (low|high);
	}
	
	public static void showError(String input){
		System.err.println(input);
	}
}
